package com.example.iot.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.example.iot.R;
import com.example.iot.utils.HttpService;

import java.io.File;
import java.io.IOException;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class  MainActivity extends AppCompatActivity {
    HttpService http = new HttpService(9988);
@BindView(R.id.iv_main_login)
LinearLayout myiv_login;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        System.out.println("服务启动中");
        try {
            http.start();
            System.out.println("服务启动完成");
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("服务启动错误");
        }

    }
    @OnClick(R.id.iv_main_login)
    public void login(){
        Intent i=new Intent(this, LoginActivity.class);
        startActivity(i);
    }
    @OnClick(R.id.ll_main_others)
    public void other(){
        Intent i=new Intent(this, otherActivity.class);
        startActivity(i);
    }
    @OnClick(R.id.ll_main_callphone)
    public void callphone(){
        Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);//跳转到拨打电话界面，不传递电话号码
        startActivity(intent);
    }
    @OnClick(R.id.ll_main_openfile)
    public void openfile(){
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("*/*");//设置类型，我这里是任意类型，任意后缀的可以这样写。
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        startActivityForResult(intent,1);
    }
    @OnClick(R.id.ll_main_sendmessage)
    public void sendmessage(){
        Intent i=new Intent(this, sendActivity.class);
        startActivity(i);
    }
    @OnClick(R.id.ll_main_message_set)
    public void messageset(){
        Intent i=new Intent(this, MessageSetActivity.class);
        startActivity(i);
    }}